var express = require('express');
var router = express.Router();

/* GET users listing. */
router.get('/', function (req, res, next) {
    res.render('login', { msg: "请登陆" });
});

/* GET users listing. */
router.post('/submit', function (req, res, next) {
    console.log("body为：",req.body);
    if (req.body.name != null) {
        req.session.user = req.body.name;
        res.render("index");
    } else {
        res.render('login', { msg: "名称不能为空" });
        
    }
});

module.exports = router;
